import requests_html
import json

if __name__ == '__main__':
    user_agent=requests_html.user_agent()
    url="https://www.allhistory.com/book/home-list"
    #url="https://www.allhistory.com/book/home-list"
    session=requests_html.HTMLSession()
    headers={"Content-Type": "application/json;charset=UTF-8",
        "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36",
             "Cookie":"sid=59082a376e79d1556e46aebb5a056e11; sys_lang=zh; UM_distinctid=175bf82cb359ad-06c7950532967-c781f38-1fa400-175bf82cb36b30; CNZZDATA1279273237=1027902748-1605235056-%7C1605235056; _cbshow=true; page.prev.id=409vpp3jkhfp2y7e; page.id=409vpp2ikhfp30fp; refer.url=https%3A%2F%2Fwww.allhistory.com%2F"
             }
    #datas=dict(cultureArea= "EAST",end=1100,language="cn",start="700",type="ALL")

    #r=session.get(url,headers=headers)
    #r=session.post(url,headers=headers,data={'cultureArea': "EAST",'end':1100,'language':"cn",'start':"700",type:"ALL"})
    r=session.get(url,headers=headers)
    r.html.render(sleep=1,timeout=15)
    html=r.html.html
    print(html)
    session.close()
